Показано с 1 по 10 из 27

Тема: [MV-MZ] Вызов меню во время сообщений

Древовидный режим

Предыдущее сообщение Предыдущее сообщение   Следующее сообщение Следующее сообщение
  1. #1
    Супер-модератор Аватар для dirge
    Информация о пользователе
    Регистрация
    25.02.2013
    Сообщений
    924
    Репутация: 79 Добавить или отнять репутацию

    По умолчанию [MV-MZ] Вызов меню во время сообщений

    [MV]Вызов меню


    Автор: dirge
    Описание: Позволяет вызывать меню игры во время сообщений\выбора.
    Версии для MV и MZ идентичны, на данный момент.

    Спойлер плагин:
    Код:
    /*=============================================================================
     *  CallMenu.js
     *=============================================================================*/
    
    var Imported = Imported || {};
    Imported.CallMenu = true;
    
    /*:=============================================================================
    * @plugindesc v1.4.5 Позволяет вызвать меню игры во время сообщений\выбора при нажатии стандартных клавиш меню ESC, X, Insert, NUM0. 
    * @author dirge
    * @help
    * Если вам нужно вызвать меню во время выбора - отключите возможность отменить
    * выбор в вызове команды выбора.
    * Для лучшей совместимости с нестандартной системой сообщений\окон выбора
    * поместите этот плагин ниже остальных.
    * =============================================================================*/
    
    /*=============================================================================*/
    /* Alias */
    var _Game_Temp_initialize_Alias = Game_Temp.prototype.initialize;
    Game_Temp.prototype.initialize = function() {
    	_Game_Temp_initialize_Alias.call(this)
    	this._savedInterpreter = null;
    	this._lastSelectedChoice = null;
    };
    /* NEW */
    Game_Temp.prototype.saveInterpreter = function(f) {
        this._savedInterpreter = f
    };
    /* NEW */
    Game_Temp.prototype.getSavedInterpreter = function() {
    	return this._savedInterpreter
    };
    /* NEW */
    Game_Temp.prototype.setLastSelectedChoice = function(f) {
        this._lastSelectedChoice = f
    };
    /* NEW */
    Game_Temp.prototype.getLastSelectedChoice = function() {
    	return this._lastSelectedChoice
    };
    /* Alias */
    var _Window_ChoiceList_callOkHandler = Window_ChoiceList.prototype.callOkHandler
    Window_ChoiceList.prototype.callOkHandler = function() {
    	$gameTemp.setLastSelectedChoice(null)
    	_Window_ChoiceList_callOkHandler.call(this);
    };
    /* Alias */
    var _Window_ChoiceList_callCancelHandler = Window_ChoiceList.prototype.callCancelHandler
    Window_ChoiceList.prototype.callCancelHandler = function() {
    	$gameTemp.setLastSelectedChoice(null)
    	_Window_ChoiceList_callCancelHandler.call(this);
    };
    /* Alias */
    var _Window_ChoiceList_selectDefault = Window_ChoiceList.prototype.selectDefault
    Window_ChoiceList.prototype.selectDefault = function() {
    	if ($gameTemp.getLastSelectedChoice() !== null){
    		this.select($gameTemp.getLastSelectedChoice());
    	} else {
    		_Window_ChoiceList_selectDefault.call(this);
    	}  
    };
    /* Alias */
    var _Game_Interpreter_setupChoices_Alias = Game_Interpreter.prototype.setupChoices;
    Game_Interpreter.prototype.setupChoices = function(params) {
    	_Game_Interpreter_setupChoices_Alias.call(this, params);
    	$gameTemp.saveInterpreter(this)
    };
    /* Alias */
    var _DataManager_makeSaveContents_Alias = DataManager.makeSaveContents;
    DataManager.makeSaveContents = function () {
        var contents = _DataManager_makeSaveContents_Alias.call(this);
        contents.message = $gameMessage;
    	if ($gameMessage._choices.length !== 0) {
    	   contents.interpreter = $gameTemp.getSavedInterpreter()
    	}
        return contents;
    };
    /* Alias */
    var _DataManager_extractSaveContents_Alias = DataManager.extractSaveContents;
    DataManager.extractSaveContents = function (contents) {
        _DataManager_extractSaveContents_Alias.call(this, contents);
        $gameMessage = contents.message;
    	if ($gameMessage._choices.length !== 0) {
    		var gameInterpreter = contents.interpreter
    		$gameTemp.saveInterpreter(gameInterpreter)
    		$gameMessage.setChoiceCallback(function(n) {
    			gameInterpreter._branch[gameInterpreter._indent] = n;
    		}.bind(this));
    	}
    };
    /* Alias */
    var _Scene_Map_update_Alias = Scene_Map.prototype.update;
    Scene_Map.prototype.update = function () {
        _Scene_Map_update_Alias.call(this);
        if ((Input.isTriggered('escape') || Input.isTriggered('menu') || TouchInput.isCancelled()) && $gameMessage.isBusy() && $gameSystem.isMenuEnabled()) {
    		if ($gameMessage.isChoice()){
    			$gameTemp.setLastSelectedChoice(SceneManager._scene._windowLayer.children[0]._choiceWindow._index)
    		}
            this.callMenu();
        }
    };
    /* OVERWRITE */
    Window_Message.prototype.isTriggered = function () {
        return (Input.isRepeated('ok') || TouchInput.isRepeated());
    };
    /* Alias */
    var _Window_ChoiceList_WidthEx_Alias = Window_ChoiceList.prototype.textWidthEx;
    Window_ChoiceList.prototype.textWidthEx = function (text) {
    	if(!SceneManager._scene.isActive()) return;
    	return _Window_ChoiceList_WidthEx_Alias.call(this, text);
    };
    /* HIME_HiddenChoiceConditions Compatibility */
    var _Window_ChoiceList_makeCommandList_Alias = Window_ChoiceList.prototype.makeCommandList
    Window_ChoiceList.prototype.makeCommandList = function() {
    	if(!SceneManager._scene.isActive()) return;
    	_Window_ChoiceList_makeCommandList_Alias.call(this);
    }
    /* Galv_VisualNovelChoices Compatibility */
    if (Imported.Galv_VisualNovelChoices) {
    	var _Window_ChoiceList_drawItem_Alias = Window_ChoiceList.prototype.drawItem 
    	Window_ChoiceList.prototype.drawItem = function(index) {
    	if(typeof this.choice_background === 'undefined'){
    		this.choice_background = [];
    	};
    		_Window_ChoiceList_drawItem_Alias.call(this, index);
    	};
    }
    /* SRD_TitleCommandCustomizer Compatibility */
    if (Imported["SumRndmDde Title Command Customizer"]) {
    	var _Scene_Title_createMessageWindow_Alias = Scene_Title.prototype.createMessageWindow
    	Scene_Title.prototype.createMessageWindow = function() {
    		$gameMessage.clear();
    		_Scene_Title_createMessageWindow_Alias.call(this)
    		
    	};
    }
    
    /* End of File */
    /*=============================================================================*/


    P.S. Не уверен, что он кому-то еще пригодится, но вдруг кто-то решит сделать ВН)
    Последний раз редактировалось dirge; 06.08.2020 в 23:15. Причина: v 1.4.5

Информация о теме

Пользователи, просматривающие эту тему

Эту тему просматривают: 1 (пользователей: 0 , гостей: 1)

Метки этой темы

Социальные закладки

Социальные закладки

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •  
[MV-MZ] Вызов меню во время сообщений